#a guessing game where a number 1 through 100 is generated and the user gets 3 tries to guess
#Fine imports
import random
#makin functions:1. check if number is or not the random number
#tell if user won or lost
#hit maxtries or not
#
#
#
#

def numchk(a, b):
        if a == b:
                return True
        else:
                return False

#def victory(numchk(),trying()):
        #if numchk() and trying():
def getanswer():
        answer = input("My answer is: ")
        return answer
                





limit = 100
maxtries = 3
limit = input("Upper limit: ")
#maxtries = input("This is untested.\nmaximum number of tries is 1 + input:")
rando = random.randint(1,limit)


#debug show number toggle
debug = 0
##########################################

tries = 0
intro = "WELCOME! I have right here a number. You have three tries to guess it!"
FirstGuess = "Tell me what you think the number is?"
retry = 'Hmm... \n*checks notes* \nThat number is wrong. \nTry again!', 'You go \nSorry, I read that wrong. \nYou didn\'t get it right. \nTry again.', 'Aww. Wrong number.\nTry again!'
lasttry = 'One more time!\nYou can do it!', 'IT IS THE FINAL ROUND OF THE MATCH!\nFIGHT!', 'This is your last chance!\nWhat is your guess?'
victorymsg = 'You did it!', 'Congratulations!', 'You won!', 'Victory!'
gameover = 'You tried your best! \nBut.... this is a guessing game so you really couldn\'t do much', 'Sorry, all those guesses are wrong :(', 'All were wrong, try again later!'


#print rando
if debug == 1:
	print "debug is on"
	print "A mysterious force tells you: " , rando

	
	print "!!!!!!!!!!!!!  \n\n\n\n !!!!!!!!!!!!!!!!!!!!!"

#Intro and request input number

print intro
print "Tell me a number between 1 and ", limit, "!"
answer = getanswer()
tries += 1
while not numchk(answer,rando) and not numchk(tries,maxtries):
        answer = getanswer()
	tries += 1
if numchk(answer,rando):
        print random.choice(victorymsg)
	
elif numchk(tries,maxtries):
        
	print random.choice(gameover)
	print rando
else:
        print "this shouldn't happen"



#


